{% extends 'student_base.html' %}

{% block context %}
    <div>
        <div class="bd-example">
        <table class="table table-striped" style="margin:0 150px;width: 80%;text-align: center;vertical-align: middle">
          <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">课程名</th>
            <th scope="col">学院</th>
            <th scope="col">教师</th>
            <th scope="col">加入时间</th>
            <th scope="col">考试安排</th>
            <th scope="col">操作</th>
          </tr>
          </thead>
          <tbody>
          {% if infos %}
              {% for info in infos %}
            <tr>
                <th scope="row">{{ forloop.counter }}</th>
                <td>{{ info.name }}</td>
                <td>{{ info.college }}</td>
                <td>{{ info.teacher_name }}</td>
                <td>{{ info.creat_time }}</td>
                {% if info.exam_set %}
                    <td>开始时间{{ info.start_time }}<br>截止时间{{ info.end_time }}<br>考试时长{{ info.limit_time }}分钟</td>
                    {% if info.state %}
                        {% if info.total_score == 0 %}
                            <td>已提交试卷</td>
                        {% else %}
                            <td>{{ info.total_score }}分</td>
                        {% endif %}

                    {% else %}
                        <td><a href="{% url 'student:startexamindex' qid=info.id %}">开始考试</a></td>
                    {% endif %}

                {% else %}
                    <td>暂未安排考试</td>
                    <td>暂未安排考试</td>
                {% endif %}
          {% endfor %}
          {% else %}
            <tr><td colspan="5" align="center">暂未加入任何课程</td></tr>
          {% endif %}

          </tbody>
        </table>
        </div>
 </div>
{% endblock %}